import request from '@/utils/request'

// 登录
export const login = data => {
  return request({
    method: 'POST',
    url: `/login/cellphone?timestamp=${data.timestamp}`,
    data
  })
}

// 获取登录状态
export const loginStatus = data => {
  return request({
    method: 'GET',
    url: `/login/status?timestamp=${Date.now()}&cookie=${data}`
  })
}

// 获取二维码 key
export const getQRKey = () => {
  return request({
    method: 'GET',
    url: `/login/qr/key?timerstamp=${Date.now()}`
  })
}

// 二维码生成接口
export const createQR = data => {
  return request({
    method: 'POST',
    url: `/login/qr/create?key=${data}&qrimg=true&timerstamp=${Date.now()}`
  })
}

// 检查扫码状态
export const checkQRStatus = data => {
  return request({
    method: 'POST',
    url: `/login/qr/check?key=${data}&timerstamp=${Date.now()}`
  })
}

// 退出登录
export const loginOut = () => {
  return request({
    method: 'GET',
    url: '/logout'
  })
}
